package com.face.server.repository;

import com.face.server.entity.EventLog;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;

import java.util.Date;
import java.util.List;

public interface EventLogRepository extends MongoRepository<EventLog, String> {

    Long countByBuildNumberIsAndTimeBetweenAndTypeIs(Integer buildNum,Date start,Date end,int type);

    Page<EventLog> findByNameRegexOrEventIsAndTypeIs(String name,boolean event,int type,Pageable pageable);

    Page<EventLog> findByTypeIs(int type,Pageable pageable);

    Page<EventLog> findByTypeIsAndBuildNumberIn(Integer type,List<Integer> buildList,Pageable pageable);

    List<EventLog> findByBuildNumberInAndTypeIsAndTimeAfter(List<Integer> buildList,int type,Date date);

    List<EventLog> findByNameAndTypeIsAndBuildNumberIn(String name,int type,List<Integer> buildList);

}
